package com.you.mavenbuildtest.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

@Controller
public class LoginController {
    @RequestMapping(value = "/request", method = RequestMethod.POST)
    public void requestTest(@RequestBody String id, HttpServletRequest request, HttpServletResponse response){
        Object obj = ProxyController.map.get("ProxyController");

        Class cls = obj.getClass();
        try {
            Method getReq = cls.getDeclaredMethod("getReq", new Class[]{String.class});
            getReq.invoke(obj,new Object[]{"1"});
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

    @RequestMapping(value = "/httpstest")
    @ResponseBody
    public String httpstest(){
        return "https";
    }

}
